package org.simtube.util;

import java.util.Comparator;

import org.simtube.index.CEntry;
import org.simtube.index.Region;

public class EntryComparator implements Comparator<CEntry> {

	private Region q;
	
	public EntryComparator(Region q) {
		this.q = q;
	}
	
	@Override
	public int compare(CEntry en0, CEntry en1) {
		return Double.compare(Region.distance(q, en0.getRegion()),
				Region.distance(q, en1.getRegion()));
	}

}
